<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>5&nbsp;程序员定义的数据类型</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="racket.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-racket.css" title="default"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Racket&#25351;&#21335;</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="intro.html" class="tocviewlink" data-pltdoc="x">&#27426;&#36814;&#26469;&#21040;Racket!</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket&#27010;&#35201;</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">&#20869;&#32622;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">&#34920;&#36798;&#24335;&#21644;&#23450;&#20041;</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">&#27169;&#22359;</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">&#36755;&#20837;&#21644;&#36755;&#20986;</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">&#27491;&#21017;&#34920;&#36798;&#24335;</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">&#24322;&#24120;&#19982;&#25511;&#21046;</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">&#36845;&#20195;&#21644;&#25512;&#23548;</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">&#27169;&#24335;&#21305;&#37197;</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="classes.html" class="tocviewlink" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">&#21333;&#20803;</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">&#21453;&#23556;&#21644;&#21160;&#24577;&#27714;&#20540;</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">&#23439;</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">&#21019;&#36896;&#35821;&#35328;</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">&#24182;&#21457;&#19982;&#21516;&#27493;</a></td></tr><tr><td align="right">19&nbsp;</td><td><a href="performance.html" class="tocviewlink" data-pltdoc="x">&#24615;&#33021;</a></td></tr><tr><td align="right">20&nbsp;</td><td><a href="parallelism.html" class="tocviewlink" data-pltdoc="x">&#24182;&#34892;</a></td></tr><tr><td align="right">21&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">&#36816;&#34892;&#21644;&#21019;&#24314;&#21487;&#25191;&#34892;&#31243;&#24207;</a></td></tr><tr><td align="right">22&nbsp;</td><td><a href="More_Libraries.html" class="tocviewlink" data-pltdoc="x">&#26356;&#22810;&#30340;&#24211;</a></td></tr><tr><td align="right">23&nbsp;</td><td><a href="dialects.html" class="tocviewlink" data-pltdoc="x">Racket&#21644;Scheme&#30340;&#26041;&#35328;</a></td></tr><tr><td align="right">24&nbsp;</td><td><a href="other-editors.html" class="tocviewlink" data-pltdoc="x">&#21629;&#20196;&#34892;&#24037;&#20855;&#21644;&#20320;&#30340;&#32534;&#36753;&#22120;&#36873;&#25321;</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9658;</a></td><td>5&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">5.1&nbsp;</td><td><a href="#%28part._.Simple-.Structure-.Types-struct%29" class="tocviewlink" data-pltdoc="x">&#31616;&#21333;&#30340;&#32467;&#26500;&#31867;&#22411;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span></a></td></tr><tr><td align="right">5.2&nbsp;</td><td><a href="#%28part._struct-copy%29" class="tocviewlink" data-pltdoc="x">&#22797;&#21046;&#21644;&#26356;&#26032;</a></td></tr><tr><td align="right">5.3&nbsp;</td><td><a href="#%28part._struct-subtypes%29" class="tocviewlink" data-pltdoc="x">&#32467;&#26500;&#23376;&#31867;&#22411;</a></td></tr><tr><td align="right">5.4&nbsp;</td><td><a href="#%28part._trans-struct%29" class="tocviewlink" data-pltdoc="x">&#19981;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#19982;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#23545;&#27604;</a></td></tr><tr><td align="right">5.5&nbsp;</td><td><a href="#%28part._struct-equal%29" class="tocviewlink" data-pltdoc="x">&#32467;&#26500;&#30340;&#27604;&#36739;</a></td></tr><tr><td align="right">5.6&nbsp;</td><td><a href="#%28part._.Structure-.Type-.Generativity%29" class="tocviewlink" data-pltdoc="x">&#32467;&#26500;&#31867;&#22411;&#30340;&#29983;&#25104;&#24615;</a></td></tr><tr><td align="right">5.7&nbsp;</td><td><a href="#%28part._prefab-struct%29" class="tocviewlink" data-pltdoc="x">&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;</a></td></tr><tr><td align="right">5.8&nbsp;</td><td><a href="#%28part._struct-options%29" class="tocviewlink" data-pltdoc="x">&#26356;&#22810;&#30340;&#32467;&#26500;&#31867;&#22411;&#36873;&#39033;</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">5.1<tt>&nbsp;</tt></span><a href="#%28part._.Simple-.Structure-.Types-struct%29" class="tocsubseclink" data-pltdoc="x">&#31616;&#21333;&#30340;&#32467;&#26500;&#31867;&#22411;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span></a></td></tr><tr><td><span class="tocsublinknumber">5.2<tt>&nbsp;</tt></span><a href="#%28part._struct-copy%29" class="tocsubseclink" data-pltdoc="x">&#22797;&#21046;&#21644;&#26356;&#26032;</a></td></tr><tr><td><span class="tocsublinknumber">5.3<tt>&nbsp;</tt></span><a href="#%28part._struct-subtypes%29" class="tocsubseclink" data-pltdoc="x">&#32467;&#26500;&#23376;&#31867;&#22411;</a></td></tr><tr><td><span class="tocsublinknumber">5.4<tt>&nbsp;</tt></span><a href="#%28part._trans-struct%29" class="tocsubseclink" data-pltdoc="x">&#19981;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#19982;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#23545;&#27604;</a></td></tr><tr><td><span class="tocsublinknumber">5.5<tt>&nbsp;</tt></span><a href="#%28part._struct-equal%29" class="tocsubseclink" data-pltdoc="x">&#32467;&#26500;&#30340;&#27604;&#36739;</a></td></tr><tr><td><span class="tocsublinknumber">5.6<tt>&nbsp;</tt></span><a href="#%28part._.Structure-.Type-.Generativity%29" class="tocsubseclink" data-pltdoc="x">&#32467;&#26500;&#31867;&#22411;&#30340;&#29983;&#25104;&#24615;</a></td></tr><tr><td><span class="tocsublinknumber">5.7<tt>&nbsp;</tt></span><a href="#%28part._prefab-struct%29" class="tocsubseclink" data-pltdoc="x">&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;</a></td></tr><tr><td><span class="tocsublinknumber">5.8<tt>&nbsp;</tt></span><a href="#%28part._struct-options%29" class="tocsubseclink" data-pltdoc="x">&#26356;&#22810;&#30340;&#32467;&#26500;&#31867;&#22411;&#36873;&#39033;</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="parameterize.html" title="backward to &quot;4.13 动态绑定：parameterize&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racket指南&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="modules.html" title="forward to &quot;6 模块&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3>5<tt>&nbsp;</tt><a name="(part._define-struct)"></a>&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</h3><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#22312;&#12298;Racket&#21442;&#32771;&#12299;&#20013;&#30340;&#8220;&#65288;structures&#65289;&#8221;&#37096;&#20998;&#20063;&#26377;&#20851;&#20110;&#25968;&#25454;&#32467;&#26500;&#31867;&#22411;&#30340;&#25991;&#26723;&#12290;</p></blockquote></blockquote></blockquote><p>&#26032;&#30340;&#25968;&#25454;&#31867;&#22411;&#36890;&#24120;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#34920;&#26469;&#21019;&#36896;&#65292;&#36825;&#26159;&#26412;&#31456;&#30340;&#20027;&#39064;&#12290;&#22522;&#20110;&#31867;&#30340;&#23545;&#35937;&#31995;&#32479;&#65292;&#25105;&#20204;&#21442;&#29031;&#12298;<a href="classes.html" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a>&#12299;&#65292;&#20026;&#21019;&#24314;&#26032;&#30340;&#25968;&#25454;&#31867;&#22411;&#25552;&#20379;&#20102;&#19968;&#31181;&#26367;&#25442;&#26426;&#21046;&#65292;&#20294;&#21363;&#20351;&#26159;&#31867;&#21644;&#23545;&#35937;&#20063;&#26159;&#26681;&#25454;&#32467;&#26500;&#31867;&#22411;&#23454;&#29616;&#12290;</p><h4>5.1<tt>&nbsp;</tt><a name="(part._.Simple-.Structure-.Types-struct)"></a>&#31616;&#21333;&#30340;&#32467;&#26500;&#31867;&#22411;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span></h4><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#22312;&#12298;Racket&#21442;&#32771;&#12299;&#20013;&#30340;&#8220;&#65288;define-struct&#65289;&#8221;&#37096;&#20998;&#20063;&#26377;&#20851;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#30340;&#25991;&#26723;&#12290;</p></blockquote></blockquote></blockquote><p>&#20316;&#20026;&#19968;&#20010;&#26368;&#25509;&#36817;&#30340;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#30340;&#35821;&#27861;&#26159;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">field-id</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></div></p><p><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#34920;&#32465;&#23450;<span class="RktVar">struct-id</span>&#21644;&#19968;&#20010;&#26631;&#35782;&#31526;&#30340;&#25968;&#20540;&#65292;&#23427;&#26500;&#24314;&#20110;<span class="RktVar">struct-id</span>&#21644;<span class="RktVar">field-id</span>&#65306;</p><ul><li><p><span class="RktVar">struct-id</span>&#65306;&#19968;&#20010;<a name="(tech._~e6~9e~84~e9~80~a0~e5~99~a8~ef~bc~88constructor~ef~bc~89)"></a><span style="font-style: italic">&#26500;&#36896;&#22120;&#65288;constructor&#65289;</span>&#20989;&#25968;&#65292;&#24102;&#26377;&#21644;acket[_field-id]&#30340;&#25968;&#20540;&#19968;&#26679;&#22810;&#30340;&#21442;&#25968;&#65292;&#24182;&#36820;&#22238;&#36825;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#12290;</p><p><div class="SIntrapara">Example:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;posn&gt;</span></p></td></tr></table></blockquote></div></p></li><li><p><span class="RktVar">struct-id</span><span class="RktSym">?</span>&#65306;&#19968;&#20010;<a name="(tech._~e5~88~a4~e6~96~ad~ef~bc~88predicate~ef~bc~89)"></a><span style="font-style: italic">&#21028;&#26029;&#65288;predicate&#65289;</span>&#20989;&#25968;&#65292;&#23427;&#24102;&#19968;&#20010;&#21333;&#20010;&#21442;&#25968;&#65292;&#21516;&#26102;&#22914;&#26524;&#23427;&#26159;&#36825;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#21017;&#36820;&#22238;<span class="RktVal">#t</span>&#65292;&#21542;&#21017;&#36820;&#22238;<span class="RktVal">#f</span>&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn?</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn?</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></blockquote></div></p></li><li><p><span class="RktVar">struct-id</span><span class="RktSym">-</span><span class="RktVar">field-id</span>&#65306;&#23545;&#20110;&#27599;&#20010;<span class="RktVar">field-id</span>&#65292;&#19968;&#20010;<a name="(tech._~e8~ae~bf~e9~97~ae~e5~99~a8~ef~bc~88accessor~ef~bc~89)"></a><span style="font-style: italic">&#35775;&#38382;&#22120;&#65288;accessor&#65289;</span>&#20174;&#36825;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#20013;&#35299;&#26512;&#30456;&#24212;&#23383;&#27573;&#30340;&#20540;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn-x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn-y</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">2</span></p></td></tr></table></blockquote></div></p></li><li><p><span class="RktSym">struct:</span><span class="RktVar">struct-id</span>&#65306;&#19968;&#20010;<a name="(tech._~e7~bb~93~e6~9e~84~e7~b1~bb~e5~9e~8b~e6~8f~8f~e8~bf~b0~e7~ac~a6~ef~bc~88structure._type._descriptor~ef~bc~89)"></a><span style="font-style: italic">&#32467;&#26500;&#31867;&#22411;&#25551;&#36848;&#31526;&#65288;structure type descriptor&#65289;</span>&#65292;&#23427;&#26159;&#19968;&#20010;&#20540;&#65292;&#20307;&#29616;&#32467;&#26500;&#31867;&#22411;&#20316;&#20026;&#19968;&#20010;&#31532;&#19968;&#31867;&#20540;&#65288;&#19982;<span class="RktPn">#:super</span>&#65292;&#22312;&#12298;<a href="#%28part._struct-options%29" data-pltdoc="x">&#26356;&#22810;&#30340;&#32467;&#26500;&#31867;&#22411;&#36873;&#39033;</a>&#12299;&#20013;&#20316;&#20026;&#21518;&#32493;&#35752;&#35770;&#65289;&#12290;</p></li></ul><p>&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#34920;&#23545;&#20540;&#30340;&#31181;&#31867;&#19981;&#35774;&#32622;&#32422;&#26463;&#26465;&#20214;&#65292;&#23427;&#21487;&#34920;&#29616;&#20026;&#36825;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#20013;&#30340;&#23383;&#27573;&#12290;&#20363;&#22914;&#65292;<span class="RktPn">(</span><span class="RktSym">posn</span><span class="stt"> </span><span class="RktVal">"apple"</span><span class="stt"> </span><span class="RktVal">#f</span><span class="RktPn">)</span>&#36807;&#31243;&#20135;&#29983;&#19968;&#20010;<span class="RktSym">posn</span>&#23454;&#20363;&#65292;&#21363;&#20351;<span class="RktVal">"apple"</span>&#21644;<span class="RktVal">#f</span>&#23545;<span class="RktSym">posn</span>&#23454;&#20363;&#30340;&#26174;&#24615;&#20351;&#29992;&#26159;&#26080;&#25928;&#30340;&#37197;&#22871;&#12290;&#25191;&#34892;&#23383;&#27573;&#20540;&#19978;&#30340;&#32422;&#26463;&#65292;&#27604;&#22914;&#35201;&#27714;&#23427;&#20204;&#26159;&#25968;&#20540;&#65292;&#36890;&#24120;&#26159;&#19968;&#20010;&#21512;&#32422;&#30340;&#24037;&#20316;&#65292;&#22312;&#12298;<a href="contracts.html" data-pltdoc="x">&#21512;&#32422;</a>&#12299;&#20013;&#20316;&#20026;&#21518;&#32493;&#35752;&#35770;&#12290;</p><h4>5.2<tt>&nbsp;</tt><a name="(part._struct-copy)"></a>&#22797;&#21046;&#21644;&#26356;&#26032;</h4><p><span class="RktSym"><span class="badlink"><span class="RktValLink">struct-copy</span></span></span>&#34920;&#20811;&#38534;&#19968;&#20010;&#32467;&#26500;&#24182;&#21487;&#36873;&#22320;&#26356;&#26032;&#20811;&#38534;&#20013;&#30340;&#25351;&#23450;&#23383;&#27573;&#12290;&#36825;&#20010;&#36807;&#31243;&#26377;&#26102;&#31216;&#20026;&#19968;&#20010;<a name="(tech._~e5~8a~9f~e8~83~bd~e6~80~a7~e6~9b~b4~e6~96~b0~ef~bc~88functional._update~ef~bc~89)"></a><span style="font-style: italic">&#21151;&#33021;&#24615;&#26356;&#26032;&#65288;functional update&#65289;</span>&#65292;&#22240;&#20026;&#36825;&#20010;&#32467;&#26524;&#26159;&#19968;&#20010;&#24102;&#26377;&#26356;&#26032;&#23383;&#27573;&#20540;&#30340;&#32467;&#26500;&#12290;&#20294;&#21407;&#22987;&#30340;&#32467;&#26500;&#27809;&#26377;&#34987;&#20462;&#25913;&#12290;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct-copy</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktVar">struct-expr</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktVar">field-id</span><span class="hspace">&nbsp;</span><span class="RktVar">expr</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>&#20986;&#29616;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct-copy</span></span></span>&#21518;&#38754;&#30340;<span class="RktVar">struct-id</span>&#24517;&#39035;&#26159;&#30001;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#32465;&#23450;&#30340;&#32467;&#26500;&#31867;&#22411;&#21517;&#31216;&#65288;&#21363;&#36825;&#20010;&#21517;&#31216;&#19981;&#33021;&#20316;&#20026;&#19968;&#20010;&#34920;&#36798;&#24335;&#30452;&#25509;&#34987;&#20351;&#29992;&#65289;&#12290;<span class="RktVar">struct-expr</span>&#24517;&#39035;&#20135;&#29983;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#12290;&#32467;&#26524;&#26159;&#19968;&#20010;&#26032;&#23454;&#20363;&#65292;&#23601;&#20687;&#26087;&#30340;&#32467;&#26500;&#31867;&#22411;&#19968;&#26679;&#65292;&#38500;&#36825;&#20010;&#34987;&#27599;&#20010;<span class="RktVar">field-id</span>&#26631;&#26126;&#30340;&#23383;&#27573;&#24471;&#21040;&#30456;&#24212;&#30340;<span class="RktVar">expr</span>&#30340;&#20540;&#20043;&#22806;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">p1</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">p2</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct-copy</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktSym">p1</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn-x</span><span class="hspace">&nbsp;</span><span class="RktSym">p2</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn-y</span><span class="hspace">&nbsp;</span><span class="RktSym">p2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(3 2)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn-x</span><span class="hspace">&nbsp;</span><span class="RktSym">p1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">posn-x</span><span class="hspace">&nbsp;</span><span class="RktSym">p2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(1 3)</span></p></td></tr></table></blockquote></div></p><h4>5.3<tt>&nbsp;</tt><a name="(part._struct-subtypes)"></a>&#32467;&#26500;&#23376;&#31867;&#22411;</h4><p><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#30340;&#19968;&#20010;&#25193;&#23637;&#34920;&#21487;&#20197;&#29992;&#26469;&#23450;&#20041;&#19968;&#20010;<span style="font-style: italic">&#32467;&#26500;&#23376;&#31867;&#22411;&#65288;structure subtype&#65289;</span>&#65292;&#23427;&#26159;&#19968;&#31181;&#25193;&#23637;&#19968;&#20010;&#29616;&#26377;&#32467;&#26500;&#31867;&#22411;&#30340;&#32467;&#26500;&#31867;&#22411;&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktVar">super-id</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">field-id</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>&#36825;&#20010;<span class="RktVar">super-id</span>&#24517;&#39035;&#26159;&#19968;&#20010;&#30001;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#32465;&#23450;&#30340;&#32467;&#26500;&#31867;&#22411;&#21517;&#31216;&#65288;&#21363;&#21517;&#31216;&#19981;&#33021;&#34987;&#20316;&#20026;&#19968;&#20010;&#34920;&#36798;&#24335;&#30452;&#25509;&#20351;&#29992;&#65289;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">3d-posn</span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">z</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>&#19968;&#20010;&#32467;&#26500;&#23376;&#31867;&#22411;&#32487;&#25215;&#20854;&#36229;&#31867;&#22411;&#30340;&#23383;&#27573;&#65292;&#24182;&#19988;&#23376;&#31867;&#22411;&#26500;&#36896;&#22120;&#25509;&#21463;&#22312;&#36229;&#31867;&#22411;&#23383;&#27573;&#30340;&#20540;&#20043;&#21518;&#30340;&#23376;&#31867;&#22411;&#23383;&#27573;&#30340;&#20540;&#12290;&#19968;&#20010;&#32467;&#26500;&#23376;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#21487;&#20197;&#34987;&#29992;&#20316;&#36825;&#20010;&#36229;&#31867;&#22411;&#30340;&#21028;&#26029;&#21644;&#35775;&#38382;&#22120;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">p</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">3d-posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktSym">p</span></td></tr><tr><td><p><span class="RktRes">#&lt;3d-posn&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn?</span><span class="hspace">&nbsp;</span><span class="RktSym">p</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">3d-posn-z</span><span class="hspace">&nbsp;</span><span class="RktSym">p</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">3d-posn&#26377;&#19968;&#20010;x&#23383;&#27573;&#65292;&#20294;&#26159;&#36825;&#37324;&#21364;&#27809;&#26377;3d-posn-x&#36873;&#25321;&#22120;&#65306;</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">3d-posn-x</span><span class="hspace">&nbsp;</span><span class="RktSym">p</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">3d-posn-x: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#20351;&#29992;&#22522;&#31867;&#22411;&#30340;posn-x&#36873;&#25321;&#22120;&#21435;&#35775;&#38382;x&#23383;&#27573;&#65306;</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn-x</span><span class="hspace">&nbsp;</span><span class="RktSym">p</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr></table></blockquote></div></p><h4>5.4<tt>&nbsp;</tt><a name="(part._trans-struct)"></a>&#19981;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#19982;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#23545;&#27604;</h4><p>&#29992;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#23450;&#20041;&#22914;&#19979;&#65306;</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#20197;&#19981;&#26174;&#31034;&#20851;&#20110;&#23383;&#27573;&#20540;&#30340;&#20219;&#20309;&#20449;&#24687;&#30340;&#26041;&#24335;&#25171;&#21360;&#12290;&#20063;&#23601;&#26159;&#35828;&#65292;&#40664;&#35748;&#30340;&#32467;&#26500;&#31867;&#22411;&#26159;<a name="(tech._~e4~b8~8d~e9~80~8f~e6~98~8e~e7~9a~84~ef~bc~88opaque~ef~bc~89)"></a><span style="font-style: italic">&#19981;&#36879;&#26126;&#30340;&#65288;opaque&#65289;</span>&#12290;&#22914;&#26524;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#35775;&#38382;&#22120;&#21644;&#20462;&#25913;&#22120;&#23545;&#19968;&#20010;&#27169;&#22359;&#20445;&#25345;&#31169;&#26377;&#65292;&#37027;&#20040;&#27809;&#26377;&#20854;&#23427;&#30340;&#27169;&#22359;&#21487;&#20197;&#20381;&#36182;&#36825;&#20010;&#31867;&#22411;&#23454;&#20363;&#30340;&#34920;&#31034;&#12290;</p><p>&#35753;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;<a name="(tech._~e9~80~8f~e6~98~8e~ef~bc~88transparent~ef~bc~89)"></a><span style="font-style: italic">&#36879;&#26126;&#65288;transparent&#65289;</span>&#65292;&#22312;&#23383;&#27573;&#21517;&#24207;&#21015;&#21518;&#38754;&#20351;&#29992;<span class="RktPn">#:transparent</span>&#20851;&#38190;&#23383;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:transparent</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(posn 1 2)</span></p></td></tr></table></td></tr></table></blockquote><p>&#19968;&#20010;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#20687;&#19968;&#20010;&#23545;&#26500;&#36896;&#22120;&#30340;&#35843;&#29992;&#19968;&#26679;&#25171;&#21360;&#65292;&#22240;&#27492;&#23427;&#26174;&#31034;&#36825;&#20010;&#32467;&#26500;&#23383;&#27573;&#20540;&#12290;&#19968;&#20010;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#20063;&#20801;&#35768;&#21453;&#23556;&#25805;&#20316;&#65292;&#27604;&#22914;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct?</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct-info</span></span></span>&#65292;&#22312;&#20854;&#23454;&#20363;&#20013;&#34987;&#20351;&#29992;&#65288;&#21442;&#35265;&#12298;<a href="reflection.html" data-pltdoc="x">&#21453;&#23556;&#21644;&#21160;&#24577;&#27714;&#20540;</a>&#12299;&#65289;&#12290;</p><p>&#40664;&#35748;&#24773;&#20917;&#19979;&#65292;&#32467;&#26500;&#31867;&#22411;&#26159;&#19981;&#36879;&#26126;&#30340;&#65292;&#22240;&#20026;&#19981;&#36879;&#26126;&#30340;&#32467;&#26500;&#23454;&#20363;&#25552;&#20379;&#20102;&#26356;&#22810;&#30340;&#23553;&#35013;&#20445;&#35777;&#12290;&#20063;&#23601;&#26159;&#35828;&#65292;&#19968;&#20010;&#24211;&#21487;&#20197;&#20351;&#29992;&#19981;&#36879;&#26126;&#30340;&#32467;&#26500;&#26469;&#23553;&#35013;&#25968;&#25454;&#65292;&#32780;&#24211;&#20013;&#30340;&#23458;&#25143;&#26426;&#38500;&#20102;&#22312;&#24211;&#20013;&#34987;&#20801;&#35768;&#20043;&#22806;&#65292;&#20063;&#19981;&#33021;&#25805;&#32437;&#32467;&#26500;&#20013;&#30340;&#25968;&#25454;&#12290;</p><h4>5.5<tt>&nbsp;</tt><a name="(part._struct-equal)"></a>&#32467;&#26500;&#30340;&#27604;&#36739;</h4><p>&#19968;&#20010;&#36890;&#29992;&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span>&#27604;&#36739;&#33258;&#21160;&#20986;&#29616;&#22312;&#19968;&#20010;&#36879;&#26126;&#30340;&#32467;&#26500;&#31867;&#22411;&#30340;&#23383;&#27573;&#19978;&#65292;&#20294;&#26159;<span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span>&#40664;&#35748;&#20165;&#38024;&#23545;&#19981;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#30340;&#23454;&#20363;&#26631;&#35782;&#65306;</p><p><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">glass</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">height</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:transparent</span><span class="RktPn">)</span></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">glass</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">glass</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">height</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slab</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slab</span><span class="hspace">&nbsp;</span><span class="RktSym">slab</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slab</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></td></tr></table></blockquote></div></p><p>&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span>&#25903;&#25345;&#23454;&#20363;&#27604;&#36739;&#32780;&#19981;&#38656;&#35201;&#20351;&#32467;&#26500;&#22411;&#36879;&#26126;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;<span class="RktPn">#:methods</span>&#20851;&#38190;&#23383;&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">gen:equal+hash</span></span></span>&#24182;&#25191;&#34892;&#19977;&#20010;&#26041;&#27861;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">height</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:methods</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">gen:equal+hash</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">equal-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">b</span><span class="hspace">&nbsp;</span><span class="RktSym">equal?-recur</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#27604;&#36739;</span><span class="RktSym">a</span><span class="RktCmt">&#21644;</span><span class="RktSym">b</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">equal?-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-width</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-width</span><span class="hspace">&nbsp;</span><span class="RktSym">b</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">equal?-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-height</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-height</span><span class="hspace">&nbsp;</span><span class="RktSym">b</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">hash-recur</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#35745;&#31639;&#39318;&#35201;&#30340;</span><span class="RktSym">a</span><span class="RktCmt">&#21704;&#24076;&#20195;&#30721;&#12290;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-width</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-height</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash2-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">hash2-recur</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#35745;&#31639;&#27425;&#37325;&#35201;&#30340;</span><span class="RktSym">a</span><span class="RktCmt">&#21704;&#24076;&#20195;&#30721;&#12290;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash2-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-width</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hash2-recur</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead-height</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></td></tr></table></blockquote><p>&#21015;&#34920;&#20013;&#30340;&#31532;&#19968;&#20010;&#20989;&#25968;&#23454;&#29616;&#23545;&#20004;&#20010;<span class="RktSym">lead</span>&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span>&#27979;&#35797;&#65307;&#20989;&#25968;&#30340;&#31532;&#19977;&#20010;&#21442;&#25968;&#26159;&#29992;&#26469;&#20195;&#26367;<span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span>&#23454;&#29616;&#36882;&#24402;&#30340;&#30456;&#31561;&#27979;&#35797;&#65292;&#20197;&#20415;&#36825;&#20010;&#25968;&#25454;&#24490;&#29615;&#21487;&#20197;&#34987;&#27491;&#30830;&#22788;&#29702;&#12290;&#20854;&#23427;&#20004;&#20010;&#20989;&#25968;&#35745;&#31639;&#20197;<font class="badlink"><span class="techoutside"><span class="techinside">&#21704;&#24076;&#34920;&#65288;hash tables&#65289;</span></span></font>&#20351;&#29992;&#30340;&#39318;&#35201;&#30340;&#21644;&#27425;&#37325;&#35201;&#30340;&#21704;&#24076;&#20195;&#30721;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-hash</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">hash-set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">hash-ref</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">hash-ref</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">lead</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">hash-ref: no value found for key</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">key: #&lt;lead&gt;</span></p></td></tr></table></blockquote><p>&#25317;&#26377;<span class="RktSym"><span class="badlink"><span class="RktValLink">gen:equal+hash</span></span></span>&#30340;&#31532;&#19968;&#20010;&#20989;&#25968;&#19981;&#38656;&#35201;&#36882;&#24402;&#27604;&#36739;&#32467;&#26500;&#30340;&#23383;&#27573;&#12290;&#20363;&#22914;&#65292;&#34920;&#31034;&#19968;&#20010;&#38598;&#21512;&#30340;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#21487;&#20197;&#36890;&#36807;&#26816;&#26597;&#36825;&#20010;&#38598;&#21512;&#30340;&#25104;&#21592;&#26159;&#30456;&#21516;&#30340;&#26469;&#25191;&#34892;&#30456;&#31561;&#65292;&#29420;&#31435;&#20110;&#20869;&#37096;&#34920;&#31034;&#30340;&#20803;&#32032;&#39034;&#24207;&#12290;&#21482;&#26159;&#35201;&#27880;&#24847;&#21704;&#24076;&#20989;&#25968;&#23545;&#20219;&#20309;&#20004;&#20010;&#20551;&#23450;&#30456;&#31561;&#30340;&#32467;&#26500;&#31867;&#22411;&#20135;&#29983;&#30456;&#21516;&#30340;&#20540;&#12290;</p><h4>5.6<tt>&nbsp;</tt><a name="(part._.Structure-.Type-.Generativity)"></a>&#32467;&#26500;&#31867;&#22411;&#30340;&#29983;&#25104;&#24615;</h4><p>&#27599;&#27425;&#23545;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#34920;&#27714;&#20540;&#26102;&#65292;&#23427;&#23601;&#29983;&#25104;&#19968;&#20010;&#19982;&#25152;&#26377;&#29616;&#26377;&#32467;&#26500;&#31867;&#22411;&#19981;&#21516;&#30340;&#32467;&#26500;&#31867;&#22411;&#65292;&#21363;&#20351;&#26576;&#20123;&#20854;&#23427;&#32467;&#26500;&#31867;&#22411;&#20855;&#26377;&#30456;&#21516;&#30340;&#21517;&#31216;&#21644;&#23383;&#27573;&#12290;</p><p>&#36825;&#31181;&#29983;&#25104;&#24615;&#23545;&#24378;&#21046;&#25277;&#35937;&#21644;&#25191;&#34892;&#31243;&#24207;&#65288;&#27604;&#22914;&#21475;&#35793;&#21592;&#65289;&#26159;&#26377;&#29992;&#30340;&#65292;&#20294;&#23567;&#24515;&#25918;&#32622;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#34920;&#21040;&#34987;&#22810;&#27425;&#27714;&#20540;&#30340;&#20301;&#32622;&#12290;</p><p><div class="SIntrapara"><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:transparent</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">new every time</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cond</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">else</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish-size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td> </td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null</span></span></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(list (fish 1))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">fish-size: contract violation;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">given value instantiates a different structure type with</span></p></td></tr><tr><td><p><span class="RktErr">the same name</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: fish?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: (fish 1)</span></p></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:transparent</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cond</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">else</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish-size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">add-bigger-fish</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(list (fish 2) (fish 1))</span></p></td></tr></table></td></tr></table></blockquote></div></p><h4>5.7<tt>&nbsp;</tt><a name="(part._prefab-struct)"></a>&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;</h4><p>&#34429;&#28982;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#36879;&#26126;</span></span></font>&#32467;&#26500;&#31867;&#22411;&#20197;&#26174;&#31034;&#20869;&#23481;&#30340;&#26041;&#24335;&#25171;&#21360;&#65292;&#20294;&#19981;&#20687;&#19968;&#20010;&#25968;&#20540;&#12289;&#23383;&#31526;&#20018;&#12289;&#31526;&#21495;&#25110;&#21015;&#34920;&#30340;&#25171;&#21360;&#34920;&#65292;&#32467;&#26500;&#30340;&#25171;&#21360;&#34920;&#19981;&#33021;&#29992;&#22312;&#19968;&#20010;&#34920;&#36798;&#24335;&#20013;&#20197;&#25214;&#22238;&#32467;&#26500;&#12290;</p><p>&#19968;&#20010;<a name="(tech._~e9~a2~84~e5~88~b6~ef~bc~88prefab~ef~bc~89)"></a><span style="font-style: italic">&#39044;&#21046;&#65288;prefab&#65289;</span>&#65288;&#8220;&#34987;&#39044;&#20808;&#21046;&#36896;&#8221;&#65289;&#32467;&#26500;&#31867;&#22411;&#26159;&#19968;&#20010;&#20869;&#32622;&#30340;&#31867;&#22411;&#65292;&#23427;&#26159;&#24050;&#30693;&#30340;Racket&#25171;&#21360;&#26426;&#21644;&#34920;&#36798;&#24335;&#38405;&#35835;&#22120;&#12290;&#26377;&#26080;&#38480;&#22810;&#36825;&#26679;&#30340;&#31867;&#22411;&#23384;&#22312;&#65292;&#24182;&#19988;&#23427;&#20204;&#36890;&#36807;&#21517;&#23383;&#12289;&#23383;&#27573;&#35745;&#25968;&#12289;&#36229;&#31867;&#22411;&#20197;&#21450;&#20854;&#23427;&#32454;&#33410;&#26469;&#32034;&#24341;&#12290;&#19968;&#20010;&#39044;&#21046;&#32467;&#26500;&#30340;&#25171;&#21360;&#34920;&#31867;&#20284;&#20110;&#19968;&#20010;&#21521;&#37327;&#65292;&#20294;&#23427;&#20197;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#s</span><span class="hspace"></span></span>&#24320;&#22987;&#32780;&#19981;&#26159;&#20165;&#20197;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span>&#24320;&#22987;&#65292;&#32780;&#19988;&#25171;&#21360;&#34920;&#30340;&#31532;&#19968;&#20010;&#20803;&#32032;&#26159;&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;&#30340;&#21517;&#31216;&#12290;</p><p>&#19979;&#38754;&#30340;&#31034;&#20363;&#26174;&#31034;&#20855;&#26377;&#19968;&#20010;&#23383;&#27573;&#30340;<span class="RktSym">sprout</span>&#39044;&#32622;&#32467;&#26500;&#31867;&#22411;&#30340;&#23454;&#20363;&#12290;&#31532;&#19968;&#20010;&#23454;&#20363;&#20855;&#26377;&#19968;&#20010;&#23383;&#27573;&#20540;<span class="RktVal">'</span><span class="RktVal">bean</span>&#65292;&#20197;&#21450;&#31532;&#20108;&#20010;&#20855;&#26377;&#23383;&#27573;&#20540;<span class="RktVal">'</span><span class="RktVal">alfalfa</span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktVal">'</span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">bean</span><span class="RktVal">)</span></td></tr><tr><td><p><span class="RktRes">'#s(sprout bean)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktVal">'</span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">alfalfa</span><span class="RktVal">)</span></td></tr><tr><td><p><span class="RktRes">'#s(sprout alfalfa)</span></p></td></tr></table></blockquote><p>&#20687;&#25968;&#23383;&#21644;&#23383;&#31526;&#20018;&#19968;&#26679;&#65292;&#39044;&#32622;&#32467;&#26500;&#26159;&#8220;&#33258;&#24341;&#29992;&#8221;&#65292;&#25152;&#20197;&#19978;&#38754;&#30340;&#24341;&#21495;&#26159;&#21487;&#36873;&#30340;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">bean</span><span class="RktVal">)</span></td></tr><tr><td><p><span class="RktRes">'#s(sprout bean)</span></p></td></tr></table></blockquote><p>&#24403;&#20320;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#20351;&#29992;<span class="RktPn">#:prefab</span>&#20851;&#38190;&#23383;&#65292;&#32780;&#19981;&#26159;&#29983;&#25104;&#19968;&#20010;&#26032;&#30340;&#32467;&#26500;&#31867;&#22411;&#65292;&#20320;&#33719;&#24471;&#19982;&#29616;&#26377;&#30340;&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;&#30340;&#32465;&#23450;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lunch</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">bean</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">sprout</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">kind</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:prefab</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout?</span><span class="hspace">&nbsp;</span><span class="RktSym">lunch</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout-kind</span><span class="hspace">&nbsp;</span><span class="RktSym">lunch</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'bean</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">garlic</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#s(sprout garlic)</span></p></td></tr></table></blockquote><p>&#19978;&#38754;&#30340;&#23383;&#27573;&#21517;<span class="RktSym">kind</span>&#23545;&#26597;&#25214;&#39044;&#32622;&#32467;&#26500;&#31867;&#22411;&#26080;&#20851;&#32039;&#35201;&#65292;&#20165;&#21517;&#31216;<span class="RktSym">sprout</span>&#21644;&#23383;&#27573;&#25968;&#37327;&#26159;&#32039;&#35201;&#30340;&#12290;&#21516;&#26102;&#65292;&#20855;&#26377;&#19977;&#20010;&#23383;&#27573;&#30340;&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;<span class="RktSym">sprout</span>&#26159;&#19968;&#31181;&#19981;&#21516;&#20110;&#19968;&#20010;&#21333;&#20010;&#23383;&#27573;&#30340;&#32467;&#26500;&#31867;&#22411;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout?</span><span class="hspace">&nbsp;</span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">bean</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">17</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">sprout</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">kind</span><span class="hspace">&nbsp;</span><span class="RktSym">yummy?</span><span class="hspace">&nbsp;</span><span class="RktSym">count</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:prefab</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">redefine</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout?</span><span class="hspace">&nbsp;</span><span class="RktVal">#s</span><span class="RktVal">(</span><span class="RktVal">sprout</span><span class="hspace">&nbsp;</span><span class="RktVal">bean</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">17</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">sprout?</span><span class="hspace">&nbsp;</span><span class="RktSym">lunch</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote><p>&#19968;&#20010;&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;&#21487;&#20197;&#26377;&#21478;&#19968;&#31181;&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;&#20316;&#20026;&#23427;&#30340;&#36229;&#31867;&#22411;&#65292;&#23427;&#20855;&#26377;&#21487;&#21464;&#30340;&#23383;&#27573;&#65292;&#24182;&#23427;&#21487;&#20197;&#26377;&#33258;&#21160;&#23383;&#27573;&#12290;&#36825;&#20123;&#32500;&#24230;&#20013;&#30340;&#20219;&#20309;&#21464;&#21270;&#37117;&#23545;&#24212;&#20110;&#19981;&#21516;&#30340;&#39044;&#32622;&#32467;&#26500;&#31867;&#22411;&#65292;&#32780;&#19988;&#32467;&#26500;&#31867;&#22411;&#21517;&#31216;&#30340;&#25171;&#21360;&#34920;&#32534;&#30721;&#25152;&#26377;&#30340;&#30456;&#20851;&#32454;&#33410;&#12290;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">building</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">rooms</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">location</span><span class="hspace">&nbsp;</span><span class="RktPn">#:mutable</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:prefab</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">house</span><span class="hspace">&nbsp;</span><span class="RktSym">building</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">occupied</span><span class="hspace">&nbsp;</span><span class="RktPn">#:auto</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:prefab</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:auto-value</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">no</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">house</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">factory</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#s((house (1 no) building 2 #(1)) 5 factory no)</span></p></td></tr></table></blockquote><p>&#27599;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#39044;&#21046;</span></span></font>&#32467;&#26500;&#31867;&#22411;&#37117;&#26159;<font class="badlink"><span class="techoutside"><span class="techinside">&#36879;&#26126;</span></span></font>&#30340;&#8212;&#8212;&#20294;&#29978;&#33267;&#27604;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#36879;&#26126;</span></span></font>&#31867;&#22411;&#26356;&#25277;&#35937;&#65292;&#22240;&#20026;&#21487;&#20197;&#21019;&#24314;&#23454;&#20363;&#32780;&#19981;&#24517;&#35775;&#38382;&#19968;&#20010;&#29305;&#23450;&#30340;&#32467;&#26500;&#31867;&#22411;&#22768;&#26126;&#25110;&#29616;&#26377;&#31034;&#20363;&#12290;&#24635;&#20307;&#32780;&#35328;&#65292;&#32467;&#26500;&#31867;&#22411;&#30340;&#19981;&#21516;&#36873;&#39033;&#25552;&#20379;&#20102;&#20174;&#26356;&#25277;&#35937;&#21040;&#26356;&#26041;&#20415;&#30340;&#19968;&#36830;&#20018;&#21487;&#33021;&#24615;&#65306;</p><ul><li><p><a href="#%28tech._~e4~b8~8d~e9~80~8f~e6~98~8e~e7~9a~84~ef~bc~88opaque~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#19981;&#36879;&#26126;&#30340;&#65288;Opaque&#65289;</span></a>&#65288;&#40664;&#35748;&#65289;&#65306;&#27809;&#26377;&#35775;&#38382;&#32467;&#26500;&#31867;&#22411;&#22768;&#26126;&#65292;&#23601;&#19981;&#33021;&#26816;&#26597;&#25110;&#21019;&#36896;&#23454;&#20363;&#12290;&#27491;&#22914;&#19979;&#19968;&#33410;&#25152;&#35752;&#35770;&#30340;&#65292;<font class="badlink"><span class="techoutside"><span class="techinside">&#26500;&#36896;&#22120;&#30475;&#23432;&#65288;constructor guards&#65289;</span></span></font>&#21644;<font class="badlink"><span class="techoutside"><span class="techinside">&#23646;&#24615;&#65288;properties&#65289;</span></span></font>&#21487;&#20197;&#38468;&#21152;&#21040;&#32467;&#26500;&#31867;&#22411;&#19978;&#20197;&#36827;&#19968;&#27493;&#20445;&#25252;&#25110;&#19987;&#38376;&#21270;&#20854;&#23454;&#20363;&#30340;&#34892;&#20026;&#12290;</p></li><li><p><font class="badlink"><span class="techoutside"><span class="techinside">&#36879;&#26126;&#30340;&#65288;Transparent&#65289;</span></span></font>&#65306;&#20219;&#20309;&#20154;&#37117;&#21487;&#20197;&#26816;&#26597;&#25110;&#21019;&#24314;&#19968;&#20010;&#27809;&#26377;&#35775;&#38382;&#32467;&#26500;&#31867;&#22411;&#22768;&#26126;&#30340;&#23454;&#20363;&#65292;&#36825;&#24847;&#21619;&#30528;&#36825;&#20010;&#20540;&#25171;&#21360;&#26426;&#21487;&#20197;&#26174;&#31034;&#19968;&#20010;&#23454;&#20363;&#30340;&#20869;&#23481;&#12290;&#28982;&#32780;&#65292;&#25152;&#26377;&#23454;&#20363;&#21019;&#24314;&#37117;&#32463;&#36807;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#26500;&#36896;&#22120;&#30475;&#23432;</span></span></font>&#65292;&#36825;&#26679;&#21487;&#20197;&#25511;&#21046;&#19968;&#20010;&#23454;&#20363;&#30340;&#20869;&#23481;&#65292;&#24182;&#19988;&#23454;&#20363;&#30340;&#34892;&#20026;&#21487;&#20197;&#36890;&#36807;<font class="badlink"><span class="techoutside"><span class="techinside">&#23646;&#24615;&#65288;properties&#65289;</span></span></font>&#36827;&#34892;&#29305;&#20363;&#21270;&#12290;&#30001;&#20110;&#32467;&#26500;&#31867;&#22411;&#30001;&#20854;&#23450;&#20041;&#29983;&#25104;&#65292;&#23454;&#20363;&#19981;&#33021;&#31616;&#21333;&#22320;&#36890;&#36807;&#32467;&#26500;&#31867;&#22411;&#30340;&#21517;&#31216;&#26469;&#21046;&#36896;&#65292;&#22240;&#27492;&#19981;&#33021;&#30001;&#34920;&#36798;&#24335;&#35835;&#21462;&#22120;&#33258;&#21160;&#29983;&#25104;&#12290;</p></li><li><p><font class="badlink"><span class="techoutside"><span class="techinside">&#39044;&#21046;&#30340;&#65288;Prefab&#65289;</span></span></font>&#65306;&#20219;&#20309;&#20154;&#37117;&#21487;&#20197;&#22312;&#20219;&#20309;&#26102;&#20505;&#26816;&#26597;&#25110;&#21019;&#24314;&#19968;&#20010;&#23454;&#20363;&#65292;&#32780;&#19981;&#24517;&#20107;&#20808;&#35775;&#38382;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#22768;&#26126;&#25110;&#19968;&#20010;&#23454;&#20363;&#12290;&#22240;&#27492;&#65292;&#34920;&#36798;&#24335;&#35835;&#21462;&#22120;&#21487;&#20197;&#30452;&#25509;&#21046;&#36896;&#23454;&#20363;&#12290;&#23454;&#20363;&#19981;&#33021;&#20855;&#26377;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#26500;&#36896;&#22120;&#30475;&#23432;</span></span></font>&#25110;<font class="badlink"><span class="techoutside"><span class="techinside">&#23646;&#24615;</span></span></font>&#12290;</p></li></ul><p>&#30001;&#20110;&#34920;&#36798;&#24335;&#35835;&#21462;&#22120;&#21487;&#20197;&#29983;&#25104;<font class="badlink"><span class="techoutside"><span class="techinside">&#39044;&#21046;</span></span></font>&#23454;&#20363;&#65292;&#25152;&#20197;&#22312;&#20415;&#21033;&#30340;<a href="serialization.html#%28tech._~e5~ba~8f~e5~88~97~e5~8c~96~ef~bc~88serialization~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#24207;&#21015;&#21270;&#65288;serialization&#65289;</span></a>&#27604;&#25277;&#35937;&#26356;&#37325;&#35201;&#26102;&#23427;&#20204;&#26159;&#26377;&#29992;&#30340;&#12290;&#28982;&#32780;&#65292;&#22914;&#26524;&#20182;&#20204;&#22914;&#12298;<a href="serialization.html" data-pltdoc="x">&#25968;&#25454;&#31867;&#22411;&#21644;&#24207;&#21015;&#21270;</a>&#12299;&#25152;&#25551;&#36848;&#37027;&#26679;&#34987;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">serializable-struct</span></span></span>&#23450;&#20041;&#65292;<font class="badlink"><span class="techoutside"><span class="techinside">&#19981;&#36879;&#26126;</span></span></font>&#21644;<font class="badlink"><span class="techoutside"><span class="techinside">&#36879;&#26126;</span></span></font>&#30340;&#32467;&#26500;&#20063;&#21487;&#20197;&#34987;&#24207;&#21015;&#21270;&#12290;</p><h4>5.8<tt>&nbsp;</tt><a name="(part._struct-options)"></a>&#26356;&#22810;&#30340;&#32467;&#26500;&#31867;&#22411;&#36873;&#39033;</h4><p>&#26080;&#35770;&#26159;&#22312;&#32467;&#26500;&#31867;&#22411;&#32423;&#36824;&#26159;&#22312;&#20010;&#21035;&#23383;&#27573;&#32423;&#19978;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span>&#30340;&#23436;&#25972;&#35821;&#27861;&#25903;&#25345;&#35768;&#22810;&#36873;&#39033;&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktVar">maybe-super</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">field</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">struct-option</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&nbsp;</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">maybe-super</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktVar">super-id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">field</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktVar">field-id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">[</span><span class="RktVar">field-id</span><span class="hspace">&nbsp;</span><span class="RktVar">field-option</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">]</span></td></tr></table></td></tr></table></blockquote></blockquote><p>&#19968;&#20010; <span class="RktVar">struct-option</span>&#24635;&#26159;&#20197;&#19968;&#20010;&#20851;&#38190;&#23383;&#24320;&#22836;&#65306;</p><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:mutable</span></td></tr></table></blockquote><p>&#20250;&#23548;&#33268;&#32467;&#26500;&#30340;&#25152;&#26377;&#23383;&#27573;&#26159;&#21487;&#21464;&#30340;&#65292;&#24182;&#19988;&#32473;&#27599;&#20010;<span class="RktVar">field-id</span>&#20135;&#29983;&#19968;&#20010;<a name="(tech._~e8~ae~be~e7~bd~ae~e6~96~b9~e5~bc~8f)"></a><span style="font-style: italic">&#35774;&#32622;&#26041;&#24335;</span><span class="RktSym">set-</span><span class="RktVar">struct-id</span><span class="RktSym">-</span><span class="RktVar">field-id</span><span class="RktSym">!</span>&#65292;&#20854;&#22312;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#20013;&#35774;&#32622;&#23545;&#24212;&#23383;&#27573;&#30340;&#20540;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">dot</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:mutable</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">dot</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td> </td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">dot-x</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">set-dot-x!</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">dot-x</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">10</span></p></td></tr></table></blockquote></div></p><p><span class="RktPn">#:mutable</span>&#36873;&#39033;&#20063;&#21487;&#20197;&#34987;&#29992;&#26469;&#20316;&#20026;&#19968;&#20010;<span class="RktVar">field-option</span>&#65292;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#23427;&#20351;&#19968;&#20010;&#20010;&#21035;&#23383;&#27573;&#21487;&#21464;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">age</span><span class="hspace">&nbsp;</span><span class="RktPn">#:mutable</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">friend</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">"Barney"</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td> </td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">set-person-age!</span><span class="hspace">&nbsp;</span><span class="RktSym">friend</span><span class="hspace">&nbsp;</span><span class="RktVal">6</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">set-person-name!</span><span class="hspace">&nbsp;</span><span class="RktSym">friend</span><span class="hspace">&nbsp;</span><span class="RktVal">"Mary"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">set-person-name!: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:transparent</span></td></tr></table></blockquote><p>&#23545;&#32467;&#26500;&#23454;&#20363;&#30340;&#25511;&#21046;&#21453;&#23556;&#35775;&#38382;&#65292;&#22914;&#21069;&#38754;&#19968;&#33410;&#12298;<a href="#%28part._trans-struct%29" data-pltdoc="x">&#19981;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#19982;&#36879;&#26126;&#32467;&#26500;&#31867;&#22411;&#23545;&#27604;</a>&#12299;&#25152;&#35752;&#35770;&#30340;&#37027;&#26679;&#12290;</p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:inspector</span><span class="hspace">&nbsp;</span><span class="RktVar">inspector-expr</span></td></tr></table></blockquote><p>&#25512;&#24191;<span class="RktPn">#:transparent</span>&#20197;&#25903;&#25345;&#26356;&#22810;&#30340;&#25511;&#21046;&#35775;&#38382;&#25110;&#21453;&#23556;&#25805;&#20316;&#12290;</p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:prefab</span></td></tr></table></blockquote><p>&#35775;&#38382;&#20869;&#32622;&#32467;&#26500;&#31867;&#22411;&#65292;&#22914;&#21069;&#19968;&#33410;&#12298;<a href="#%28part._prefab-struct%29" data-pltdoc="x">&#39044;&#21046;&#32467;&#26500;&#31867;&#22411;</a>&#12299;&#25152;&#35752;&#35770;&#30340;&#12290;</p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:auto-value</span><span class="hspace">&nbsp;</span><span class="RktVar">auto-expr</span></td></tr></table></blockquote><p>&#25351;&#23450;&#19968;&#20010;&#34987;&#29992;&#20110;&#25152;&#26377;&#22312;&#32467;&#26500;&#31867;&#22411;&#37324;&#30340;&#33258;&#21160;&#23383;&#27573;&#20540;&#65292;&#36825;&#37324;&#19968;&#20010;&#33258;&#21160;&#23383;&#27573;&#34987;<span class="RktPn">#:auto</span>&#23383;&#27573;&#34987;&#26631;&#31034;&#12290;&#36825;&#20010;&#26500;&#36896;&#20989;&#25968;&#19981;&#25509;&#21463;&#32473;&#33258;&#21160;&#23383;&#27573;&#30340;&#21442;&#25968;&#12290;&#33258;&#21160;&#23383;&#27573;&#26080;&#30097;&#26159;&#21487;&#21464;&#30340;&#65288;&#36890;&#36807;&#21453;&#23556;&#25805;&#20316;&#65289;&#65292;&#20294;&#35774;&#32622;&#20989;&#25968;&#20165;&#22312;<span class="RktPn">#:mutable</span>&#20063;&#34987;&#25351;&#23450;&#30340;&#26102;&#20505;&#34987;&#32465;&#23450;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">z</span><span class="hspace">&nbsp;</span><span class="RktPn">#:auto</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:transparent</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:auto-value</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">posn</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(posn 1 2 0)</span></p></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:guard</span><span class="hspace">&nbsp;</span><span class="RktVar">guard-expr</span></td></tr></table></blockquote><p>&#27599;&#24403;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#23454;&#20363;&#34987;&#21019;&#24314;&#65292;&#37117;&#25351;&#23450;&#19968;&#20010;<a name="(tech._~e6~9e~84~e9~80~a0~e5~99~a8~e7~9c~8b~e5~ae~88~ef~bc~88constructor._guard~ef~bc~89)"></a><span style="font-style: italic">&#26500;&#36896;&#22120;&#30475;&#23432;&#65288;constructor guard&#65289;</span>&#36807;&#31243;&#20197;&#20379;&#35843;&#29992;&#12290;&#22312;&#32467;&#26500;&#31867;&#22411;&#20013;&#36825;&#20010;&#30475;&#23432;&#33719;&#21462;&#19982;&#32467;&#26500;&#31867;&#22411;&#20013;&#30340;&#38750;&#33258;&#21160;&#23383;&#27573;&#30456;&#21516;&#25968;&#37327;&#30340;&#21442;&#25968;&#65292;&#20877;&#21152;&#19978;&#19968;&#20010;&#23454;&#20363;&#21270;&#31867;&#22411;&#30340;&#21517;&#31216;&#65288;&#22914;&#26524;&#19968;&#20010;&#23376;&#31867;&#22411;&#34987;&#23454;&#20363;&#21270;&#65292;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#26368;&#22909;&#20351;&#29992;&#23376;&#31867;&#22411;&#30340;&#21517;&#31216;&#25253;&#21578;&#19968;&#20010;&#38169;&#35823;&#65289;&#12290;&#30475;&#23432;&#24212;&#35813;&#36820;&#22238;&#19982;&#32473;&#23450;&#20540;&#30456;&#21516;&#25968;&#37327;&#30340;&#20540;&#65292;&#20943;&#21435;&#21517;&#31216;&#21442;&#25968;&#12290;&#22914;&#26524;&#26576;&#20010;&#21442;&#25968;&#19981;&#21487;&#25509;&#21463;&#65292;&#25110;&#32773;&#23427;&#21487;&#20197;&#36716;&#25442;&#19968;&#20010;&#21442;&#25968;&#65292;&#21017;&#36825;&#20010;&#30475;&#23432;&#21487;&#20197;&#24341;&#21457;&#19968;&#20010;&#24322;&#24120;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">thing</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">name</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:transparent</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:guard</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktSym">type-name</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cond</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">symbol?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">symbol-&gt;string</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">else</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">error</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">type-name</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"bad name: ~e"</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">name</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">thing</span><span class="hspace">&nbsp;</span><span class="RktVal">"apple"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(thing "apple")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">thing</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">apple</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(thing "apple")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">thing</span><span class="hspace">&nbsp;</span><span class="RktVal">1/2</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">thing: bad name: 1/2</span></p></td></tr></table></blockquote></div></p><p>&#21363;&#20351;&#23376;&#31867;&#22411;&#23454;&#20363;&#34987;&#21019;&#24314;&#65292;&#36825;&#20010;&#30475;&#23432;&#20063;&#20250;&#34987;&#35843;&#29992;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#21482;&#26377;&#34987;&#26500;&#36896;&#22120;&#25509;&#21463;&#30340;&#23383;&#27573;&#34987;&#25552;&#20379;&#32473;&#30475;&#23432;&#65288;&#20294;&#26159;&#23376;&#31867;&#22411;&#30340;&#30475;&#23432;&#21516;&#26102;&#33719;&#24471;&#23376;&#31867;&#22411;&#28155;&#21152;&#30340;&#21407;&#22987;&#23383;&#27573;&#21644;&#29616;&#26377;&#23383;&#27573;&#65289;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktSym">thing</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">age</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:transparent</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:guard</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktSym">age</span><span class="hspace">&nbsp;</span><span class="RktSym">type-name</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">negative?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">age</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">error</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">type-name</span><span class="hspace">&nbsp;</span><span class="RktVal">"bad age: ~e"</span><span class="hspace">&nbsp;</span><span class="RktSym">age</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktSym">age</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">"John"</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(person "John" 10)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">"Mary"</span><span class="hspace">&nbsp;</span><span class="RktVal"><span class="nobreak">-1</span></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">person: bad age: -1</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">person: bad name: 10</span></p></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:methods</span><span class="hspace">&nbsp;</span><span class="RktVar">interface-expr</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktVar">body</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">]</span></td></tr></table></blockquote><p>&#20351;&#26041;&#27861;&#23450;&#20041;&#19982;&#20851;&#32852;&#21040;&#19968;&#20010;<span style="font-style: italic">&#36890;&#29992;&#25509;&#21475;&#65288;generic interface&#65289;</span>&#30340;&#32467;&#26500;&#31867;&#22411;&#20851;&#32852;&#12290;&#20363;&#22914;&#65292;&#25191;&#34892;<span class="RktSym"><span class="badlink"><span class="RktValLink">gen:dict</span></span></span>&#26041;&#27861;&#20801;&#35768;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#23454;&#20363;&#29992;&#20316;&#23383;&#20856;&#12290;&#25191;&#34892;<span class="RktSym"><span class="badlink"><span class="RktValLink">gen:custom-write</span></span></span>&#26041;&#27861;&#20801;&#35768;&#19968;&#20010;&#22914;&#20309;&#34987;<span class="RktSym">&#26174;&#31034;&#65288;display&#65289;</span>&#30340;&#32467;&#26500;&#31867;&#22411;&#30340;&#19968;&#20010;&#23454;&#20363;&#30340;&#23450;&#21046;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">cake</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">candles</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:methods</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">gen:custom-write</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">write-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">cake</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="hspace">&nbsp;</span><span class="RktSym">mode</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">cake-candles</span><span class="hspace">&nbsp;</span><span class="RktSym">cake</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">"</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">~a</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">~n"</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktVal">#\.</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">" .-~a-. ~n"</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktVal">#\|</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">" | ~a | ~n"</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktVal">#\space</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">"---~a---~n"</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktVal">#\-</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktSym">fmt</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">fprintf</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">port</span><span class="hspace">&nbsp;</span><span class="RktSym">fmt</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-string</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">display</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">cake</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktOut"></span><span class="hspace">&nbsp;</span><span class="RktOut"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktOut">..... </span><span class="hspace">&nbsp;&nbsp;</span><span class="RktOut"></span></p></td></tr><tr><td><p><span class="RktOut"></span><span class="hspace">&nbsp;</span><span class="RktOut">.-|||||-. </span></p></td></tr><tr><td><p><span class="RktOut"></span><span class="hspace">&nbsp;</span><span class="RktOut">| </span><span class="hspace">&nbsp;&nbsp;</span><span class="RktOut"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktOut"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktOut">| </span></p></td></tr><tr><td><p><span class="RktOut">-----------</span></p></td></tr></table></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:property</span><span class="hspace">&nbsp;</span><span class="RktVar">prop-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">val-expr</span></td></tr></table></blockquote><p>&#20351;&#19968;&#20010;<a name="(tech._~e5~b1~9e~e6~80~a7~ef~bc~88property~ef~bc~89)"></a><span style="font-style: italic">&#23646;&#24615;&#65288;property&#65289;</span>&#21644;&#20540;&#19982;&#32467;&#26500;&#31867;&#22411;&#30456;&#20851;&#32852;&#12290;&#20363;&#22914;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">prop:procedure</span></span></span>&#23646;&#24615;&#20801;&#35768;&#19968;&#20010;&#32467;&#26500;&#23454;&#20363;&#29992;&#20316;&#19968;&#20010;&#20989;&#25968;&#65307;&#23646;&#24615;&#20540;&#20915;&#23450;&#24403;&#20351;&#29992;&#36825;&#20010;&#32467;&#26500;&#20316;&#20026;&#19968;&#20010;&#20989;&#25968;&#26102;&#19968;&#20010;&#35843;&#29992;&#22914;&#20309;&#34987;&#25191;&#34892;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">greeter</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">name</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:property</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">prop:procedure</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">self</span><span class="hspace">&nbsp;</span><span class="RktSym">other</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-append</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"Hi "</span><span class="hspace">&nbsp;</span><span class="RktSym">other</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">", I'm "</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">greeter-name</span><span class="hspace">&nbsp;</span><span class="RktSym">self</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">joe-greet</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">greeter</span><span class="hspace">&nbsp;</span><span class="RktVal">"Joe"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td> </td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">greeter-name</span><span class="hspace">&nbsp;</span><span class="RktSym">joe-greet</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"Joe"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">joe-greet</span><span class="hspace">&nbsp;</span><span class="RktVal">"Mary"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"Hi Mary, I'm Joe"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">joe-greet</span><span class="hspace">&nbsp;</span><span class="RktVal">"John"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"Hi John, I'm Joe"</span></p></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="leftindent"><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">#:super</span><span class="hspace">&nbsp;</span><span class="RktVar">super-expr</span></td></tr></table></blockquote><p>&#29992;&#20110;&#19968;&#20010;&#19982;<span class="RktSym">struct-id</span>&#32039;&#37051;&#30340;<span class="RktSym">super-id</span>&#30340;&#19968;&#20010;&#26367;&#20195;&#32773;&#12290;&#20195;&#26367;&#19968;&#20010;&#32467;&#26500;&#31867;&#22411;&#30340;&#36825;&#20010;&#21517;&#23383;&#65288;&#23427;&#26159;&#19968;&#20010;&#34920;&#36798;&#24335;&#65289;&#65292;<span class="RktVar">super-expr</span>&#24212;&#35813;&#20135;&#29983;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#32467;&#26500;&#31867;&#22411;&#30340;&#25551;&#36848;&#31526;&#65288;structure type descriptor&#65289;</span></span></font>&#20540;&#12290;<span class="RktPn">#:super</span>&#30340;&#19968;&#20010;&#20248;&#28857;&#26159;&#32467;&#26500;&#31867;&#22411;&#30340;&#25551;&#36848;&#31526;&#26159;&#20540;&#65292;&#25152;&#20197;&#21487;&#20197;&#34987;&#20256;&#36882;&#32473;&#36807;&#31243;&#12290;</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">raven-constructor</span><span class="hspace">&nbsp;</span><span class="RktSym">super-type</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">raven</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:super</span><span class="hspace">&nbsp;</span><span class="RktSym">super-type</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:transparent</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:property</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">prop:procedure</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">self</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">'</span><span class="RktVal">nevermore</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">raven</span><span class="RktPn">)</span></td></tr><tr><td> </td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">r</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">raven-constructor</span><span class="hspace">&nbsp;</span><span class="RktSym">struct:posn</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">r</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">r</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">(list (raven 1 2) 'nevermore)</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">r</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">raven-constructor</span><span class="hspace">&nbsp;</span><span class="RktSym">struct:thing</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"apple"</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">r</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">r</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">(list (raven "apple") 'nevermore)</span></p></td></tr></table></blockquote></div></p></blockquote></blockquote><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#22312;&#12298;Racket&#21442;&#32771;&#12299;&#20013;&#30340;&#8220;&#65288;structures&#65289;&#8221;&#37324;&#25552;&#20379;&#26377;&#26356;&#22810;&#20851;&#20110;&#25968;&#25454;&#32467;&#26500;&#31867;&#22411;&#30340;&#20869;&#23481;&#12290;</p></blockquote></blockquote></blockquote><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="parameterize.html" title="backward to &quot;4.13 动态绑定：parameterize&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racket指南&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="modules.html" title="forward to &quot;6 模块&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>